<?php

namespace App\Http\Requests\Logic\Attendance;

use App\Models\User;
use App\Models\System\Admin;
use Illuminate\Foundation\Http\FormRequest;

class QueryCollection extends FormRequest
{
    /**
     * Determine if the user is authorized to make this request.
     *
     * @return bool
     */
    public function authorize()
    {
		/**
		 * @var User $user
		 */
    	$user = $this->user();
        if ($user->isManager() || $user instanceof Admin) {
        	return true;
		}
		return false;
    }

    /**
     * Get the validation rules that apply to the request.
     *
     * @return array
     */
    public function rules()
    {
        return [
        	'start' => 'nullable',
        	'end' => 'nullable',
        	'type' => 'nullable',
        	'project_id' => 'nullable'
        ];
    }
}
